<template>
  <div>
    <basic-container>
      <el-form ref="searchForm"
               :model="searchForm"
               size="mini"
               :inline="true">
        <el-form-item label="审批状态">
          <el-select v-model="searchForm.state"
                     placeholder="请选择">
            <el-option label="全部"
                       value="-1"></el-option>
            <el-option v-for="(item) in DIC.STATE_RECEIVE"
                       :key="item.id"
                       :label="item.label"
                       :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <!--<el-form-item label="仓库">
                    <el-select v-model="searchForm.warehouseId" placeholder="请选择">
                        <el-option label="全部" value="-1"></el-option>
                        <el-option v-for="(item) in warehouseData" :label="item.label" :value="item.value"></el-option>
                    </el-select>
                </el-form-item>-->
        <el-form-item label="审批编号">
          <el-input v-model="searchForm.coded"
                    placeholder="请输入审批编号"></el-input>
        </el-form-item>
        <!-- <el-form-item label="申请部门">
                    <el-input v-model="searchForm.applyUserDepartment" placeholder="请输入申请部门"></el-input>
                </el-form-item>
                <el-form-item label="申请人">
                    <el-input v-model="searchForm.applyName" placeholder="请输入申请人"></el-input>
                </el-form-item>-->
        <el-form-item label="">
          <el-button type="primary"
                     size="small"
                     plain
                     @click.stop="searchFormSubmit()">搜索</el-button>
          <el-button size="small"
                     plain
                     @click.stop="searchFormReset()">重置</el-button>
        </el-form-item>
      </el-form>
      <avue-crud :option="tabOption"
                 :data="tebData"
                 :table-loading="tebLoading"
                 :page="tebDataPage"
                 ref="crud"
                 @current-change='tebPageChange'
                 @size-change="tebSizeChange">
        <template slot-scope="scope"
                  slot="state">
          {{DIC.STATE_RECEIVE[scope.row.state].label}}<el-button type="info"
                     class="processBtn"
                     plain
                     size="mini"
                     @click.stop="processBtn(scope.row,scope.index)">流程</el-button>
        </template>
        <template slot-scope="scope"
                  slot="dealData">
          {{scope.row.applyUserDepartmentName}}/{{scope.row.applyUserName}}
        </template>
        <template slot-scope="scope"
                  slot="menuLeft">
          <el-button type="primary"
                     size="small"
                     plain
                     @click.stop="addModeBtn()">添加</el-button>
        </template>
        <template slot-scope="scope"
                  slot="menu">
          <el-button type="primary"
                     v-if="scope.row.state == 1 || scope.row.state == 0"
                     size="small"
                     plain
                     @click.stop="examinMenuBtn(scope.row,scope.index)">审核</el-button>
          <el-button type="primary"
                     size="small"
                     plain
                     @click.stop="seeMenuBtn(scope.row,scope.index)">查看</el-button>
          <el-button type="primary"
                     v-if="scope.row.state == 0"
                     size="small"
                     plain
                     @click.stop="updMenuBtn(scope.row,scope.index)">修改</el-button>
          <el-button type="primary"
                     size="small"
                     v-if="scope.row.state == 0"
                     plain
                     @click.stop="delMenuBtn(scope.row,scope.index)">删除</el-button>
        </template>
      </avue-crud>
    </basic-container>

    <!-- 流程 -->
    <el-dialog title="流程"
               :visible.sync="processMode"
               width="35%">
      <div class="block">
        <ul class="el-timeline is-reverse">
          <li class="el-timeline-item"
              v-for="(activity, index) in activities"
              :key="index">
            <div class="el-timeline-item__tail"></div>
            <div class="el-timeline-item__node el-timeline-item__node--normal el-timeline-item__node--"></div>
            <div class="el-timeline-item__wrapper">
              <el-card>
                <div class="el-timeline-item__content">审批人：{{activity.receiveDealerName}}&nbsp;&nbsp;&nbsp;
                  {{dealTypeData[activity.dealType]}}</div>
                <div class="el-timeline-item__timestamp is-bottom">{{activity.dealDate}}</div>
                <h4>{{validatenull(activity.dealNote)?"(无审批备注)":activity.dealNote}}</h4>
              </el-card>
            </div>
          </li>
        </ul>
      </div>
    </el-dialog>

    <!-- 领用单 -->
    <el-dialog title="领用单"
               :visible.sync="addMode"
               width="60%"
               center>
      <el-form ref="addModeForm"
               :model="addModeForm"
               :rules="addModeFormRules"
               label-width="80px"
               size="mini">
        <el-form-item label="备  注:"
                      prop="remarks">
          <el-input type="textarea"
                    maxlength="50"
                    :autosize="{ minRows: 1, maxRows: 1}"
                    v-model="addModeForm.remarks"
                    placeholder="最多可输入50字"></el-input>
        </el-form-item>
      </el-form>

      <avue-crud class="customForm"
                 :option="addModeTabOption"
                 :data="addModeTabData"
                 :table-loading="addModeTabLoading"
                 ref="crudaddModeTabData"
                 @selection-change="addModeTabselectionChange">
        <template slot-scope="scope"
                  slot="userInput">
          <el-input placeholder="请输入"
                    size="mini"
                    type="number"
                    :min="0"
                    :max="scope.row.num"
                    step="1.0"
                    v-model="scope.row.receiveInfosnum"></el-input>
        </template>
        <template slot-scope="scope"
                  slot="menuLeft">
          <el-button type="primary"
                     size="small"
                     v-if="!addModeForm.id"
                     plain
                     @click.stop="addModeSelectModeBtn()">选择物品</el-button>
          <el-button type="primary"
                     size="small"
                     v-if="!addModeForm.id"
                     plain
                     @click.stop="addModeDel()">删除</el-button>
        </template>
      </avue-crud>

      <span slot="footer"
            class="dialog-footer">
        <el-button size="small"
                   @click="addMode = false">关 闭</el-button>
        <el-button size="small"
                   type="primary"
                   @click="addModeSubmit()">提 交</el-button>
      </span>
    </el-dialog>

    <!-- 选择物品 -->
    <el-dialog title="选择物品"
               :visible.sync="addModeSelectMode"
               width="55%"
               class="customMode">
      <el-form ref="tableOptionSearch"
               :model="addModeSelectModeForm"
               size="mini"
               :inline="true">
        <el-form-item label="物品类型:"
                      label-width="80px">
          <el-cascader v-model="addModeSelectModeForm.type"
                       :options="dangerousGoodsDataS"
                       :show-all-levels="false"></el-cascader>
        </el-form-item>
        <el-form-item label="物品编码:"
                      label-width="80px">
          <el-input v-model="addModeSelectModeForm.coded"
                    placeholder="请输入物品编码"></el-input>
        </el-form-item>
        <el-form-item label="物品名称:"
                      label-width="80px">
          <el-input v-model="addModeSelectModeForm.name"
                    placeholder="请输入物品名称"></el-input>
        </el-form-item>
        <el-form-item label-width="15px">
          <el-button type="primary"
                     @click="addModeSelectModeSearch()">搜 索</el-button>
        </el-form-item>

      </el-form>
      <el-row :span="24">
        <!--<el-col :span="3" :offset="0">
                    <el-tree :data="treeData" highlight-current  @node-click="handleNodeClick"></el-tree>
                    &lt;!&ndash;<ul>
                        <li :class="{active:activeDepartment==-1?true:false}" @click.stop="changeEquipment(-1)">全部</li>
                        <li v-for='v in treeData' :key='v.id' :class="{active:v.id==activeDepartment?true:false}" @click.stop="changeEquipment(v.id)">{{v.name}}</li>
                    </ul>&ndash;&gt;
                </el-col>
                <el-col :span="21">-->

        <el-form ref="addModeSelectModeFormSubmit"
                 :model="addModeSelectModeFormSubmit"
                 size="mini" :rules="tableOptionSearchRules"
                 :inline="true">
          <el-form-item label="仓库:"
                        label-width="70px" prop="warehouseId">
            <el-select v-model="addModeSelectModeFormSubmit.warehouseId"
                       placeholder="请选择">
              <el-option v-for="(item) in warehouseData"
                         :key="item.id"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <avue-crud class="customForm"
                   :option="addModeSelectModeTabOption"
                   :data="addModeSelectModeTabData"
                   :table-loading="addModeTabLoading"
                   :page="addModeTabSelectModePage"
                   ref="crud"
                   @current-change='addModetebPageChange'
                   @size-change="addModetebSizeChange"
                   @selection-change="addModeselectionChange">
        </avue-crud>
        <!--</el-col>-->
      </el-row>
      <span slot="footer"
            class="dialog-footer"
            style="text-align: center;">
        <el-button size="small "
                   @click="addModeSelectMode = false">关 闭</el-button>
        <el-button size="small "
                   type="primary"
                   @click="addModeSelectModeSubmit()">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 查看领用单 -->
    <el-dialog title="领用单"
               :visible.sync="examineMode"
               width="60%"
               center
               class="examineModeClass">
      <el-row>
        <el-col :span="24">审批单号：{{examineModeData.coded}}</el-col>
      </el-row>
      <el-row>
        <!--<el-col :span="6">仓库：{{examineModeData.aaaa}}</el-col>-->
        <el-col :span="6">部门：{{examineModeData.applyUserDepartmentName}}</el-col>
        <el-col :span="6">申请人：{{examineModeData.applyUserName}}</el-col>
        <el-col :span="6">申请时间：{{examineModeData.purchasingDate}}</el-col>
      </el-row>
      <el-row>
        <el-col :span="24">备注：{{examineModeData.note}}</el-col>
      </el-row>

      <avue-crud class="customForm"
                 :option="examineModeTabOption"
                 :data="examineModeData.receiveInfos"
                 :table-loading="examineModeTabLoading"
                 ref="crud">
      </avue-crud>

      <span slot="footer"
            class="dialog-footer"
            style="text-align: center;">
        <!--<el-button size="small"
                   v-if="examineModeType == 2"
                   type="primary">打印</el-button>-->
        <el-button size="small"
                   v-if="examineModeType == 1"
                   @click="examineModeBtn(false)">不通过</el-button>
        <el-button size="small"
                   v-if="examineModeType == 1"
                   type="primary"
                   @click="examineModeBtn(true)">通 过</el-button>
        <el-button size="small"
                   @click="examineMode = false">关 闭</el-button>
      </span>
    </el-dialog>

    <el-dialog title="审核"
               :visible.sync="examineModeState.mode"
               width="30%"
               center
               class="examineModeClass">
      <el-form ref="addModeForm"
               :model="examineModeState.form"
               :rules="addModeFormRules"
               label-width="80px"
               size="mini">
        <el-form-item label="备  注:"
                      prop="remarks">
          <el-input type="textarea"
                    maxlength="100"
                    :autosize="{ minRows: 4, maxRows: 10}"
                    v-model="examineModeState.form.remarks"
                    placeholder="最多可输入100字"></el-input>
        </el-form-item>
      </el-form>

      <span slot="footer"
            class="dialog-footer"
            style="text-align: center;">
        <el-button size="small"
                   @click="examineModeState.mode = false">关 闭</el-button>
        <el-button size="small"
                   type="primary"
                   @click="submitExamineModeBtn">{{examineModeState.name}}</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { tabOption, addModeTabOption, addModeSelectModeTabOption, addModeTreeProps, examineModeTabOption } from "@/const-personal/dangerous/receive/apply.js"
import { getListOfReceive, addReceive, updReceive, delReceive, examineReceive } from "@/api/consumables/receive/receive.js"
import { getListDangerousTypeAll } from "@/api/consumables/receive/dangerousType.js"
import { getListWarehouseAll } from "@/api/public/warehouse.js"
import { getListOfSearchSelect, addDangerousGoods, updDangerousGoods, delDangerousGoods } from "@/api/consumables/receive/apply.js"
import { validatenull } from '@/util/validate'
import { getUsersByProjectId } from "@/api/ledger/progect"
import { DIC } from '@/const/dic'
import { getGoodsTypeInfo} from "@/api/consumables/consumablesMining/purchase"
import { getStore } from '@/util/store'
import { tableOptionModeAddFormRules } from "@/const-personal/equipment/appointment/lend.js"
import { DepartmentTreeV, getDepartmentTreeOfId, DepartmentTree, DepartmentTreeVChildrenNull } from "@/util/util.js"
export default {
  data () {
    return {
      dealTypeData: ['未审核', '不通过', '通过'],
      examineModeData: {},
      dangerousGoodsData: [],
      userInfo: getStore({ name: "userInfoData" }),
      addModeSelectModeFormSubmit:{},
      tableOptionSearchRules:{
          warehouseId: [
              { required: true, message: '请选择仓库', trigger: 'change' }
          ],
      },
      DIC: DIC,
      //表格结构
      tabOption: tabOption,
      addModeTabOption: addModeTabOption,
      addModeSelectModeTabOption: addModeSelectModeTabOption,
      examineModeTabOption: examineModeTabOption,
      //审核mode状态
      examineModeType: 0,
      //树状图
      addModeTreeProps: addModeTreeProps,
      //表格多选
      addModeTabselectionList: [],
      //表格数据
      tebData: [],
      addModeTabData: [],
      addModeSelectModeTabData: [],
      //表格等待
      tebLoading: false,
      addModeTabLoading: false,
      examineModeTabLoading: false,
      //表格分页
      tebDataPage: {
        total: 0, //总页数
        currentPage: 1, //当前页数
        pageSize: 10, //每页显示多少条
          pageSizes: [5,10,20] //显示多少条数据
      },
      addModeTabSelectModePage: {
        total: 0, //总页数
        currentPage: 1, //当前页数
        pageSize: 5, //每页显示多少条
          pageSizes: [5,10,20] //显示多少条数据
      },
      examineModeDataPage: {
        total: 0, //总页数
        currentPage: 1, //当前页数
        pageSize: 10, //每页显示多少条
          pageSizes: [5,10,20] //显示多少条数据
      },
      addModeTabDataPage: {
        total: 0, //总页数
        currentPage: 1, //当前页数
        pageSize: 5, //每页显示多少条
          pageSizes: [5,10,20] //显示多少条数据
      },
      //搜索表单数据
      searchForm: {
        state: '-1', //状态
        warehouseId: '-1', //仓库
        number: null,  //审批编号
        department: null,  //申请部门
        people: null  //申请人
      },
      //添加表单数据
      addModeForm: {

      },
      //添加表单筛选设别
      addModeSelectModeForm: {
        warehouseId: '-1',
        type: ['-1']
      },
      //添加表单验证
      addModeFormRules: tableOptionModeAddFormRules,
      //流程模态框
      processMode: false,
      //添加模态框
      addMode: false,
      //审核模态框
      examineMode: false,
      //添加选择设别
      addModeSelectMode: false,
      //流程数据
      activities: [],
      activeDepartment: null,
      //树状图数据
      treeData: [],
      addModeType: 0, //1为
      warehouseData: [],
      goodsListSelect: [],
      dangerousGoodsDataS:[],
      examineModeState: {
        mode: false,
        form: {
          remarks: ''
        }
      },
    }
  },
  created () {
    this.searchFormSubmit()
    this.getWarehouseData()
    this.goodsTypeList()
  },
  methods: {
    //仓库数据
    getWarehouseData () {
      getListWarehouseAll().then(res => {
        if (res.data.code == 200) {
          res.data.data.forEach(item => {
            this.warehouseData.push({ label: item.name, value: item.id })
          })
        } else {
          this.$notify.error({ title: '查询失败', message: '获取仓库数据失败！', type: 'danger', });
        }
      })
    },
    //树状图点击
    handleNodeClick (data) {
      this.addModeSelectModeForm.dangerousTypeId = data.id;
    },
    //添加
    addModeBtn () {
      this.addModeTabOption.selection = true;
      this.addModeForm.id = null
      this.addMode = true;
      this.addModeForm.remarks = '';
      this.addModeTabData = []
      this.addModeSelectModeSearch();
    },
    goodsTypeList () {
      this.addModeTabData = []
      getListDangerousTypeAll().then(res => {
        if (res.data.code == 200) {
          this.dangerousGoodsData = DepartmentTreeVChildrenNull(res.data.data)
            this.dangerousGoodsDataS = DepartmentTreeVChildrenNull(res.data.data,[{label: '全部',value: '-1'}])
        } else {
          this.$notify.error({ title: '查询失败', message: '获取危险品种类失败！', type: 'danger', });
        }
      })
    },
    //选择物品
    addModeSelectModeBtn () {
      this.addModeSelectMode = true;
      //流程
    },
    processBtn (row, index) {
      this.processMode = true;
      this.activities = row.processList
    },
    //删除
    delMenuBtn (row, index) {
      this.$confirm('是否删除改跳数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        delReceive(row.id).then(res => {
          if (res.data.code == 200) {
            this.$notify({ title: '操作成功', type: 'success', message: '已删除成功!' });
            this.searchFormSubmit();
          } else {
            this.$notify.error({ title: '操作失败', message: res.data.message, type: 'danger', });
          }
        })
      }).catch(() => {
        this.$notify({ title: '已取消删除', type: 'info', });
      });
    },
    //审核
    examinMenuBtn (row, index) {
      this.examineMode = true;
      this.examineModeType = 1;
      this.examineModeData = row
    },
    //查看打印
    seeMenuBtn (row, index) {
      this.examineMode = true;
      this.examineModeType = 2;
      this.examineModeData = row
    },
    //修改
    updMenuBtn (row, index) {
      this.addModeTabOption.selection = false
      this.addModeForm.remarks = row.note
      this.addModeForm.id = row.id
      this.addModeTabData = []
      row.receiveInfos.forEach(item => {
        this.addModeTabData.push({
          receiveInfosnum: item.num,
          wareHouseName: item.wareHouseName,
          goodsId: item.goodsId,
          goodsName: item.name,
          goodsCoded: item.goodsCoded,
          specs: item.specs,
          num: item.maxNum,
          unit: item.unit,
        })
      });
      this.addMode = true;
    },
    //提交审核
    examineModeBtn (state) {
      this.examineModeState = {
        mode: true,
        name: state ? '通 过' : '不通过',
        id: this.examineModeData.id,
        status: state ? 0 : 1,
        form: {
          remarks: ''
        }
      }
    },
    submitExamineModeBtn () {
      let data = {
        id: this.examineModeState.id,
        status: this.examineModeState.status,
        remarks: this.examineModeState.form.remarks
      }
      examineReceive(data).then(res => {
        if (res.data.code == 200) {
          this.$notify({ title: '操作成功', type: 'success', message: '审核成功!' });
          this.examineMode = false;
          this.examineModeState.mode = false;
          this.searchFormSubmit()
        } else {
          this.$notify.error({ title: '操作失败', message: res.data.message, type: 'danger', });
        }
      })
    },
    //tab-分页
    tebPageChange (val) {
      this.tebDataPage.currentPage = val;
      this.searchFormSubmit();
    },
    //tab-分页大小
    tebSizeChange (val) {
      this.tebDataPage.pageSize = val;
      this.searchFormSubmit();
    },
    //提交搜索
    searchFormSubmit () {
      this.tebLoading = true;
      let data = {
        state: this.searchForm.state < 0 ? null : this.searchForm.state,
        /*warehouseId:this.searchForm.warehouseId< 0 ? null:this.searchForm.warehouseId,*/
        coded: this.searchForm.coded,
        /*applyName:this.searchForm.applyName,
        applyUserDepartment : this.searchForm.applyUserDepartment,*/
        page: this.tebDataPage.currentPage,
        size: this.tebDataPage.pageSize
      }
      getListOfReceive(data).then(res => {
        if (res.data.code == 200) {
          this.tebData = res.data.data.list;
          this.tebDataPage.total = res.data.data.total;
          this.tebDataPage.currentPage = res.data.data.pageNum;
          this.tebDataPage.pageSize = res.data.data.pageSize;
        } else {
          this.$notify.error({ title: '查询失败', message: '获取危险品列表失败！', type: 'danger', });
        }
      })
      this.tebLoading = false;
    },
    //清空搜索
    searchFormReset () {
      this.searchForm.state = '-1'
      this.searchForm.warehouseId = '-1'
      this.searchForm.coded = null
      this.searchForm.applyName = null
      this.searchForm.applyUserDepartment = null
    },
    //选择物品mode --提交
    addModeSelectModeSubmit () {
      this.$refs.addModeSelectModeFormSubmit.validate((valid)=>{
          if (valid) {
              let warehouseName = ''
              for(let i = 0 ; i < this.warehouseData.length; i++){
                  if(this.warehouseData[i].value == this.addModeSelectModeFormSubmit.warehouseId){
                      warehouseName = this.warehouseData[i].label;
                      i = this.warehouseData.length;
                  }
              }
              this.goodsListSelect.forEach(item => {
                  let isAdd = true;
                  this.addModeTabData.forEach(itemS => {
                      if (item.id == itemS.goodsId) {
                          isAdd = false;
                      }
                  })
                  if (isAdd) {
                      this.addModeTabData.push({
                          wareHouseName: warehouseName,
                          wareHouseId: this.addModeSelectModeFormSubmit.warehouseId,
                          goodsId: item.id,
                          goodsName: item.name,
                          goodsCoded: item.coded,
                          specs: item.specs,
                          num: item.inventoryCount,
                          unit: item.unit,
                          receiveInfosnum: 0,
                      })
                  }
              })
              this.addModeSelectMode = false;
          }
      })
    },
    //tab-分页
    addModetebPageChange (val) {
      this.addModeTabSelectModePage.currentPage = val;
      this.addModeSelectModeSearch();
    },
    //tab-分页大小
    addModetebSizeChange (val) {
      this.addModeTabSelectModePage.pageSize = val;
      this.addModeSelectModeSearch();
    },
    addModeselectionChange (list) {
      this.goodsListSelect = list;
    },
    //选择物品mode --搜索
    addModeSelectModeSearch () {
      this.addModeTabLoading = true;
      let data = {
        dangerousTypeId: this.addModeSelectModeForm.type[this.addModeSelectModeForm.type.length - 1] == '-1' ?
            null : this.addModeSelectModeForm.type[this.addModeSelectModeForm.type.length - 1] ,
        warehouseId: this.addModeSelectModeForm.warehouseId == -1 ? null : this.addModeSelectModeForm.warehouseId,
        coded: this.addModeSelectModeForm.coded,
        name: this.addModeSelectModeForm.name      }
      data.page = this.addModeTabSelectModePage.currentPage;
      data.size = this.addModeTabSelectModePage.pageSize;
        getGoodsTypeInfo(data).then(res => {
        if (res.data.code == 200) {
          this.addModeSelectModeTabData = res.data.data.list;
          this.addModeTabSelectModePage.total = res.data.data.total;
          this.addModeTabSelectModePage.currentPage = res.data.data.pageNum;
          this.addModeTabSelectModePage.pageSize = res.data.data.pageSize;
        } else {
          this.$notify.error({ title: '查询失败', message: '获取物品列表失败！', type: 'danger', });
        }
      })
      this.addModeTabLoading = false;
    },
    //添加mode --选中
    addModeTabselectionChange (list) {
      this.addModeTabselectionList = list
    },
    //添加mode --提交
    addModeSubmit () {
      this.$refs['addModeForm'].validate((valid) => {
        if (valid) {
          let data = {
            note: this.addModeForm.remarks,
            receiveInfos: []
          }
          this.addModeTabData.forEach(item => {
            data.receiveInfos.push({
              num: item.receiveInfosnum,
              goodsId: item.goodsId,
                wareHouseId:item.wareHouseId
            })
          })
          if (validatenull(this.addModeForm.id)) {
            addReceive([data]).then(res => {
              if (res.data.code == 200) {
                this.$notify({ title: '操作成功', type: 'success', message: '已添加成功!' });
                this.searchFormSubmit()
                this.addMode = false
              } else {
                this.$notify.error({ title: '操作失败', message: res.data.message, type: 'danger', });
              }
            })
          } else {
            data.id = this.addModeForm.id;
            updReceive([data]).then(res => {
              if (res.data.code == 200) {
                this.$notify({ title: '操作成功', type: 'success', message: '已添加成功!' });
                this.searchFormSubmit()
                this.addMode = false
              } else {
                this.$notify.error({ title: '操作失败', message: res.data.message, type: 'danger', });
              }
            })
          }
        }
      });
    },
    //添加mode --删除
    addModeDel () {
      if (validatenull(this.addModeTabselectionList)) {
        this.$notify.error({ title: '操作失败', message: '请选择至少一条数据！', type: 'danger', });
        return;
      }
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'
      }).then(() => {
        //请求--删除
        this.addModeTabselectionList.reverse();
        this.addModeTabselectionList.forEach(item => {
          this.$delete(this.addModeTabData, item.$index)
        })
        this.$refs['crudaddModeTabData'].toggleSelection(this.addModeTabselectionList);
        this.$notify({ title: '删除成功', type: 'success', });
      });
    },
    // 切换类型
    changeEquipment (i) {
      this.activeDepartment = i;
      this.searchFormSubmit();
    }
  }
}
</script>

<style>
.customForm .avue-crud__menu {
  float: left;
  display: inline-block;
  width: auto;
}
.customForm .avue-crud__right {
  float: right;
}
.customForm .avue-crud__right button {
  margin-right: 0px !important;
  margin-left: 8px !important;
}
.customForm .avue-crud__tip {
  margin: 0px;
}
.customMode .el-dialog__footer {
  text-align: center;
}
.customMode .avue-crud__tip {
  display: none;
}
.examineModeClass .el-row {
  margin: 0 0 10px 5px;
}

.customModeDIv ul {
  max-height: 280px;
  overflow-y: auto;
}
.customModeDIv li {
  padding: 10px 0;
  cursor: pointer;
}
.customModeDIv li.active {
  font-weight: bold;
}
</style>